package cn.easybuy.web.pre;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.easybuy.entity.User;
import cn.easybuy.service.UserService;
import cn.easybuy.service.impl.UserServiceImpl;

public class LoginNameHasServlet extends HttpServlet{

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String loginame=request.getParameter("loginName");
		UserService us=new UserServiceImpl();
		PrintWriter out=response.getWriter();
		List<User> list=us.getUsersByLoginName(loginame);
		boolean used=false;
		if (list.size()>0) {
			used=true;
		}else {
			used=false;
		}
		out.print(used);
		out.flush();
		out.close();
		
	}

}
